#include "ProcessPool.hpp"
#include "Task.hpp"


void Usage(std::string proc)
{
    std::cout << "Usage:" << proc << "process - num " << std::endl;
}

// we are master
int main(int argc,char* argv[])
{
    // judge commands ate correct
    if(argc != 2)
    {
        Usage(argv[0]);
        return UsageError;
    }

    std::vector<Channel> channels;  // help master control channels
    int nums = std::stoi(argv[1]);

    // 1. Init ProcessPool
    InitProcessPool(nums, channels, Worker);

    // 2. Send tasks
    DispatchTask(channels);

    // 3. Quie ProcessPool
    CleanProcessPool(channels);
    
    return 0;
}